import React, { Component } from 'react';
class ctrsy extends Component {
  constructor(props) {
    super(props);
    this.state = {  }
    this.input1 = React.createRef()
    this.input2 = React.createRef()
  }
  render() { 
    return ( 
      <div>
        <div>
          <input type="text" ref={this.input1} placeholder="a内容"></input> &nbsp;&nbsp;
          <button onClick={this.showData1}>获取a</button>  &nbsp;&nbsp;
          <input onBlur={this.showData2} type="text" ref={this.input2} placeholder="b内容"></input>
        </div>
      </div>
    );
  }
  showData1 = () => {
    console.log(this.input1.current.value)
  }
  showData2 = () => {
    console.log(this.input2.current.value)
  }
}
 
export default ctrsy;